home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM 1996 Fall / BMUG Fall'96 PD-ROM.iso / Education / Math / MathPad 2.4 / Examples / solve < prev    next >
Text File  |  1995-04-29  |  397b  |  24 lines

  1. -- Solution of a system of equations by Cramers rule.
  2. include ":incl:solver"
  3.  
  4. -- example system of equations
  5. -- 2x +  y +  z = 2
  6. --  x -  y + 5z = 4
  7. --       y -  z = 8
  8.  
  9. A={{ 2, 1, 1},  -- coefficients
  10.    { 1,-1, 5},
  11.    { 0, 1,-1}}
  12.  
  13. C= { 2, 4, 8}   -- constants
  14.  
  15. solve(A,C):{-8.0,13.0,5.0}
  16.  
  17. x=solve(A,C)[1]
  18. y=solve(A,C)[2]
  19. z=solve(A,C)[3]
  20.  
  21. 2*x +  y +   z:2.0
  22.   x -  y + 5*z:4.0
  23.        y -   z:8.0
  24.